// MineGame.h

#ifndef MINEGAME_H
#define MINEGAME_H

#include "Size.h"
#include "Point.h"
#include "MineUIInterface.h"
#include "ObserverMineGrid.h"

/**
 * Handles the play of a MineSweeper-game.
 */
class MineGame
{
public:
	/**
	* Constructor.
	*/
	MineGame();

	/**
	* Constructor. Resizes the grid to the given size.
	*/
	MineGame( const Size& size );

	/**
	* Destructor.
	*/
	~MineGame();

	/**
	* Starts the game!
	*/
	void startGame();

private:
	// Holds the data about the grid.
	ObserverMineGrid *mineGrid;

	// The GUI.
	MineUIInterface *ui;

	/**
	* Resets the clock and grid.
	*/
	void reset();

	/**
	* Sweeps the mine (i.e. "a left click").
	*/
	void sweepMine( const Point& p );

	/**
	* Flags the mine (i.e. "a right click").
	*/
	void flagMine( const Point& p );

	/**
	* Repaints the UI.
	*/
	void repaint();
};

#endif // MINEGAME_H
